package com.alex.seo.service.site;

import com.alex.seo.domain.site.Site;
import com.alex.seo.domain.site.Wordpress;
import com.alex.seo.service.site.dto.SiteDTO;
import com.alex.seo.service.site.dto.WordpressDTO;

public abstract class SiteConverter {

	public static Site convert(SiteDTO siteDTO) {
		if (siteDTO instanceof WordpressDTO) {
			WordpressDTO wordpressDTO = (WordpressDTO) siteDTO;
			return new Wordpress(siteDTO.getName(), wordpressDTO.getUrl(), wordpressDTO.getLogin(), wordpressDTO.getPassword());
		} else {
			throw new IllegalArgumentException("Unknown site type: " + siteDTO.getClass().getSimpleName());
		}
	}
}
